﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using ScrumTable.DL.Data.Common;
using ScrumTable.DL.Data.Common.Config.Driver;
using ScrumTable.DL.Data.Common.Config.Schema;
using ScrumTable.DL.Data.Local.Config.Driver;
using ScrumTable.DL.Data.Local.Config.Schema;

#endregion

namespace ScrumTable.DL.Data.Local
{
    /// <summary>
    /// This class represents the entry point for a data assembly
    /// (plug in a.k.a. driver).
    /// </summary>
    /// <remarks>
    /// Caution: Derivations of the current class MUST provide an empty
    /// public constructor in order to be constructed from the underlying
    /// ScrumTable PlugIn library.
    /// </remarks>
    public class DataAssemblyDriverActivator : IDataAssemblyDriverActivator
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Returns true if the data assembly reqiures strong username / password authentication.
        /// </summary>
        public bool RequiresStrongAuthentication { get { return false; } }

        /// <summary>
        /// Specifies the format for the driver data source link (passed to the Connect()).
        /// </summary>
        public DataSourceLinkFormat RequiredLinkFormat { get { return DataSourceLinkFormat.None; } }

        /// <summary>
        /// Returns the file extension if the RequiredLinkFormat is set to
        /// FilePath.
        /// </summary>
        public string RequiredDataExtension { get { return ".xml"; } }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new data schema source selector.
        /// </summary>
        /// <param name="driverInfo">Specifies the information about the driver which is controls by the schema selector.</param>
        /// <returns>Returns the obtained selector instance.</returns>
        public IDataSchemaSelector CreateSchemaSelector(IDataAssemblyInfo driverInfo)
        {
            return new DataSchemaSelector(driverInfo);
        }

        /// <summary>
        /// Creates a new driver configuration source selector.
        /// </summary>
        /// <param name="driverInfo">Specifies the information about the driver which is controls by the schema selector.</param>
        /// <returns>Returns the obtained selector instance.</returns>
        public IDriverConfigSelector CreateDriverConfigSelector(IDataAssemblyInfo driverInfo)
        {
            return new DriverConfigSelector(driverInfo);
        }

        /// <summary>
        /// Creates a new data context (driver) using the given source.
        /// </summary>
        /// <param name="driverInfo">Specifies additional information about the driver and its environment.</param>
        /// <returns>Returns the created context instance.</returns>
        public IDataContext CreateContext(IDataContextInfo driverInfo)
        {
            return new DataContext(driverInfo);
        }

        #endregion

        #region Events

        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}